home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIStringBundle.idl < prev    next >
Text File  |  2006-05-08  |  4KB  |  111 lines

  1. /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. #include "nsISupports.idl"
  39. #include "nsISimpleEnumerator.idl"
  40.  
  41. %{C++
  42.  
  43. // Define Contractid and CID
  44. // {D85A17C1-AA7C-11d2-9B8C-00805F8A16D9}
  45. #define NS_STRINGBUNDLESERVICE_CID \
  46. { 0xd85a17c1, 0xaa7c, 0x11d2, \
  47.   { 0x9b, 0x8c, 0x0, 0x80, 0x5f, 0x8a, 0x16, 0xd9 } }
  48.  
  49. #define NS_STRINGBUNDLE_CONTRACTID "@mozilla.org/intl/stringbundle;1"
  50.  
  51. /** 
  52.  * observer needs to check if the bundle handle matches
  53.  */
  54. #define NS_STRBUNDLE_LOADED_TOPIC "strbundle-loaded"
  55.  
  56. %}
  57.  
  58. native nsStrBundleLoadedFunc(nsStrBundleLoadedFunc);
  59.  
  60. [scriptable, uuid(D85A17C2-AA7C-11d2-9B8C-00805F8A16D9)]
  61. interface nsIStringBundle : nsISupports
  62. {
  63.   wstring GetStringFromID(in long aID);
  64.   wstring GetStringFromName(in wstring aName);
  65.  
  66.   // this is kind of like smprintf - except that you can
  67.   // only pass it unicode strings, using the %S formatting character.
  68.   // the id or name should refer to a string in the bundle that
  69.   // uses %S.. do NOT try to use any other types.
  70.   // this uses nsTextFormatter::smprintf to do the dirty work.
  71.   wstring formatStringFromID(in long aID,
  72.                              [array, size_is(length)] in wstring params,
  73.                              in unsigned long length);
  74.   wstring formatStringFromName(in wstring aName,
  75.                                [array, size_is(length)] in wstring params,
  76.                                in unsigned long length);
  77.   /*
  78.   Implements nsISimpleEnumerator, replaces nsIEnumerator 
  79.   */
  80.   nsISimpleEnumerator getSimpleEnumeration();
  81.  
  82. };
  83.  
  84. [scriptable, uuid(D85A17C0-AA7C-11d2-9B8C-00805F8A16D9)]
  85. interface nsIStringBundleService : nsISupports
  86. {
  87.   nsIStringBundle createBundle(in string aURLSpec);
  88.   nsIStringBundle createExtensibleBundle(in string aRegistryKey);
  89.  
  90.   /**
  91.    * Formats a message string from a status code and status arguments.
  92.    * @param aStatus - The status code. This is mapped into a string ID and
  93.    *            and used in the string lookup process (see nsIErrorService).
  94.    * @param aStatusArg - The status message argument(s). Multiple arguments
  95.    *            can be separated by newline ('\n') characters.
  96.    * @return the formatted message
  97.    */
  98.   wstring formatStatusMessage(in nsresult aStatus, in wstring aStatusArg);
  99.  
  100.   /**
  101.    * flushes the string bundle cache - useful when the locale changes or
  102.    * when we need to get some extra memory back
  103.    * 
  104.    * at some point, we might want to make this flush all the bundles,
  105.    * because any bundles that are floating around when the locale changes
  106.    * will suddenly contain bad data
  107.    *
  108.    */
  109.   void flushBundles();
  110. };
  111.